package org.guegan.util.dircompare.swt;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;

public abstract class AbstractActionListener implements Listener {
	private Text text;
	
	public AbstractActionListener(Text text) {
		this.text = text;
	}
	
	protected void displayText(String output) {
		if (text != null && !text.isDisposed()) {
			final String out = (output != null) ? output : "";
			Display display = text.getDisplay();
			display.asyncExec(new Runnable() {
				@Override
				public void run() {
					text.setText(out);
				}
			});
		}
	}
	

}
